<?php

/* DB:
CREATE TABLE user (
    uid INTEGER PRIMARY KEY AUTOINCREMENT,
    name varchar(128) NOT NULL,
    gender tinyint,
    ustc_gid text NOT NULL,
    email varchar(255),
    nickname varchar(255),
    password varchar(32),
	utype tinyint
);

CREATE TABLE vexation (
    vid INTEGER PRIMARY KEY AUTOINCREMENT,
    owner INTEGER NOT NULL,
	belong INTEGER NOT NULL,
    summary varchar(255),
    detail varchar(2550),
    u_attach_entry int(11), 
    solution varchar(2550),
    v_attach_entry int(11)
);
*/
//TYPE LIST:
define("UTYPE_VOLUNTEER", 1);
define("UTYPE_UNAUTH_VOLUNTEER", 2);
define("UTYPE_USER", 10);
define("UTYPE_ADMINISTRATOR", 20);



//Database configuration @ /applications/config
class vex_model extends CI_Model {
	public function __construct() {
		$this->load->database();
	}
	
	public function write_new_vex($vexinfo) {
		$this->db->insert('vexation', $vexinfo);
	}
	
	public function get_vex_list() {
		$query = $this->db->get('vexation');
		return $query;
	}
	
	public function get_vex_info($vid) {
		$query = $this->db->get_where('vexation', array('vid' => $vid));;
		return $query;
	}
	
}
